<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*
<span class='line'>  2</span>  * vim:set spell spl=en fo=wan1croqlt tw=80 ts=2 sw=2 sts=2 sta et ai cin fenc=utf-8 ff=unix:
<span class='line'>  3</span>  *
<span class='line'>  4</span>  * Copyright (C) 2008, 2009 Mihai Şucan
<span class='line'>  5</span>  *
<span class='line'>  6</span>  * This file is part of libmacrame.
<span class='line'>  7</span>  *
<span class='line'>  8</span>  * Libmacrame is free software: you can redistribute it and/or modify
<span class='line'>  9</span>  * it under the terms of the GNU General Public License as published by
<span class='line'> 10</span>  * the Free Software Foundation, either version 3 of the License, or
<span class='line'> 11</span>  * (at your option) any later version.
<span class='line'> 12</span>  *
<span class='line'> 13</span>  * Libmacrame is distributed in the hope that it will be useful,
<span class='line'> 14</span>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class='line'> 15</span>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
<span class='line'> 16</span>  * GNU General Public License for more details.
<span class='line'> 17</span>  *
<span class='line'> 18</span>  * You should have received a copy of the GNU General Public License
<span class='line'> 19</span>  * along with Libmacrame.  If not, see &lt;http://www.gnu.org/licenses/>.
<span class='line'> 20</span>  *
<span class='line'> 21</span>  * $URL: http://code.google.com/p/libmacrame $
<span class='line'> 22</span>  * $Date: 2009-04-17 18:32:39 +0300 $
<span class='line'> 23</span>  *
<span class='line'> 24</span>  */</span><span class="WHIT">
<span class='line'> 25</span> 
<span class='line'> 26</span> </span><span class="COMM">/**
<span class='line'> 27</span>  * @author &lt;a lang="ro" href="http://www.robodesign.ro/mihai">Mihai Şucan&lt;/a>
<span class='line'> 28</span>  * @version pre-alpha
<span class='line'> 29</span>  * @requires core.js
<span class='line'> 30</span>  *
<span class='line'> 31</span>  * @fileOverview This is a plugin for libmacrame which adds important methods 
<span class='line'> 32</span>  * for manipulating strings, arrays and objects.
<span class='line'> 33</span>  */</span><span class="WHIT">
<span class='line'> 34</span> 
<span class='line'> 35</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="COMM">// We will use $ to refer to libmacrame in this plugin.</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">libmacrame</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 38</span> 
<span class='line'> 39</span> </span><span class="COMM">/*
<span class='line'> 40</span>  * If extend_objects is set to true:
<span class='line'> 41</span>  * - adds several static methods to the global Object.
<span class='line'> 42</span>  * - adds new methods to the Array.prototype.
<span class='line'> 43</span>  * - adds new methods to the String.prototype.
<span class='line'> 44</span>  */</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">extend_objects</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 46</span> 
<span class='line'> 47</span> </span><span class="COMM">// We store all the methods in $.js for easy reuse in other cases.</span><span class="WHIT">
<span class='line'> 48</span> 
<span class='line'> 49</span> </span><span class="COMM">/**
<span class='line'> 50</span>  * Holds methods for manipulating several types of JavaScript objects.
<span class='line'> 51</span>  *
<span class='line'> 52</span>  * &lt;p>This plugin extends the global Object, Array and String prototypes, adding 
<span class='line'> 53</span>  * new methods.
<span class='line'> 54</span>  *
<span class='line'> 55</span>  * &lt;p>The new methods implement common functionality.
<span class='line'> 56</span>  *
<span class='line'> 57</span>  * @namespace Holds methods for manipulating several types of JavaScript 
<span class='line'> 58</span>  * objects.
<span class='line'> 59</span>  */</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="NAME">$.js</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 61</span> 
<span class='line'> 62</span> </span><span class="COMM">/**
<span class='line'> 63</span>  * Holds the methods used for manipulating objects. These methods are very 
<span class='line'> 64</span>  * similar to their Array counter-parts.
<span class='line'> 65</span>  *
<span class='line'> 66</span>  * &lt;p>By default, the global &lt;var>Object&lt;/var> (not the 
<span class='line'> 67</span>  * &lt;var>Object.prototype&lt;/var>!) is extended to contain all the methods in this 
<span class='line'> 68</span>  * namespace. Besides these methods, &lt;var>Object&lt;/var> will have one more 
<span class='line'> 69</span>  * method: &lt;code>Object.extend&lt;/code>, which is an alias of {@link $.extend}.
<span class='line'> 70</span>  *
<span class='line'> 71</span>  * &lt;p>All of these methods use their &lt;var>this&lt;/var> object. As such, you need 
<span class='line'> 72</span>  * to pass the correct &lt;var>this&lt;/var> object.
<span class='line'> 73</span>  *
<span class='line'> 74</span>  * &lt;p>Note that the methods provided iterate over the object properties using 
<span class='line'> 75</span>  * &lt;code>for (&lt;var>property&lt;/var> in &lt;var>this&lt;/var>)&lt;/code>. As such, the order 
<span class='line'> 76</span>  * depends on the browser implementation. Also, those properties which are not 
<span class='line'> 77</span>  * enumerable 
<span class='line'> 78</span>  * (&lt;code>&lt;var>this&lt;/var>.propertyIsEnumerable(&lt;var>property&lt;/var>)&lt;/code>) are 
<span class='line'> 79</span>  * skipped.
<span class='line'> 80</span>  *
<span class='line'> 81</span>  * &lt;p>In the examples provided for each method we will assume that the objects 
<span class='line'> 82</span>  * defined are already extended. Thus code like 
<span class='line'> 83</span>  * &lt;code>&lt;var>obj&lt;/var>.filter(&lt;var>callback&lt;/var>)&lt;/code> can be written 
<span class='line'> 84</span>  * directly.
<span class='line'> 85</span>  *
<span class='line'> 86</span>  * @example
<span class='line'> 87</span>  * // To use these methods proceed as follows:
<span class='line'> 88</span>  *
<span class='line'> 89</span>  * &lt;code>var &lt;var>obj&lt;/var> = {'a' : 'test1', 'b' : 'test2', 'c' : 'test3'};
<span class='line'> 90</span>  *
<span class='line'> 91</span>  * Object.forEach.call(&lt;var>obj&lt;/var>, function (&lt;var>value&lt;/var>) {
<span class='line'> 92</span>  *   // ...
<span class='line'> 93</span>  * });&lt;/code>
<span class='line'> 94</span>  *
<span class='line'> 95</span>  * // Instead of forEach, you can use any of the methods defined in this
<span class='line'> 96</span>  * // namespace.
<span class='line'> 97</span>  *
<span class='line'> 98</span>  * @example
<span class='line'> 99</span>  * Additionally, you can extend your object to have all these methods:
<span class='line'>100</span>  *
<span class='line'>101</span>  * &lt;code>Object.extend.call(&lt;var>obj&lt;/var>, Object);&lt;/code>
<span class='line'>102</span>  *
<span class='line'>103</span>  * // After doing so, you can directly use any desired method.
<span class='line'>104</span>  * // For example:
<span class='line'>105</span>  * &lt;code>&lt;var>obj&lt;/var>.forEach(&lt;var>callback&lt;/var>)&lt;/code>.
<span class='line'>106</span>  *
<span class='line'>107</span>  * @namespace Holds the methods used for manipulating Objects.
<span class='line'>108</span>  *
<span class='line'>109</span>  * @see $.js.Array The Array functions which provide similar functionality.
<span class='line'>110</span>  */</span><span class="WHIT">
<span class='line'>111</span> </span><span class="NAME">$.js.Object</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>113</span>    * Filter the current object using the &lt;var>callback&lt;/var> function.
<span class='line'>114</span>    *
<span class='line'>115</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each property in the 
<span class='line'>116</span>    * current object, and it is given three arguments: the value, the property 
<span class='line'>117</span>    * name, and the entire object being iterated over.
<span class='line'>118</span>    *
<span class='line'>119</span>    * &lt;p>This method does not alter the current object.
<span class='line'>120</span>    *
<span class='line'>121</span>    * @example
<span class='line'>122</span>    * &lt;code>var &lt;var>obj1&lt;/var> = {'a' : 5, 'b' : 11, 'c' : 7};&lt;/code>
<span class='line'>123</span>    *
<span class='line'>124</span>    * // Filter only the properties with a value lower than 10:
<span class='line'>125</span>    *
<span class='line'>126</span>    * &lt;code>var &lt;var>obj2&lt;/var> = &lt;var>obj1&lt;/var>.filter(
<span class='line'>127</span>    *   function (&lt;var>value&lt;/var>, &lt;var>property&lt;/var>, &lt;var>object&lt;/var>) {
<span class='line'>128</span>    *     return &lt;var>value&lt;/var> &lt; 10;
<span class='line'>129</span>    *   }
<span class='line'>130</span>    * );&lt;/code>
<span class='line'>131</span>    *
<span class='line'>132</span>    * // Now &lt;code>&lt;var>obj2&lt;/var> = {'a' : 5, 'c' : 7}&lt;/code>.
<span class='line'>133</span>    *
<span class='line'>134</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>135</span>    * filtering the current object.
<span class='line'>136</span>    *
<span class='line'>137</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>138</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>139</span>    *
<span class='line'>140</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>141</span>    *
<span class='line'>142</span>    * @returns {Object} The new object contains only the properties for which the 
<span class='line'>143</span>    * &lt;var>callback&lt;/var> function returned true.
<span class='line'>144</span>    *
<span class='line'>145</span>    * @see $.js.Array.filter
<span class='line'>146</span>    */</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">  </span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>151</span> 
<span class='line'>152</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.propertyIsEnumerable</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='line'>155</span>           </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">        </span><span class="NAME">resObj</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>159</span> 
<span class='line'>160</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">resObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>162</span> 
<span class='line'>163</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>164</span>    * Execute the &lt;var>callback&lt;/var> function for each property in the current 
<span class='line'>165</span>    * object.
<span class='line'>166</span>    *
<span class='line'>167</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked with three arguments: the 
<span class='line'>168</span>    * value, the property name, and the entire object being iterated over.
<span class='line'>169</span>    *
<span class='line'>170</span>    * &lt;p>This method does not alter the current object.
<span class='line'>171</span>    *
<span class='line'>172</span>    * @example
<span class='line'>173</span>    * &lt;code>var &lt;var>obj&lt;/var> = {'a' : 10, 'b' : 11, 'c' : 12};&lt;/code>
<span class='line'>174</span>    *
<span class='line'>175</span>    * // alert() each property and value.
<span class='line'>176</span>    * &lt;code>&lt;var>obj&lt;/var>.forEach(
<span class='line'>177</span>    *   function (&lt;var>value&lt;/var>, &lt;var>property&lt;/var>) {
<span class='line'>178</span>    *     alert(&lt;var>property&lt;/var> + ' : ' + &lt;var>value&lt;/var>);
<span class='line'>179</span>    *   }
<span class='line'>180</span>    * );&lt;/code>
<span class='line'>181</span>    *
<span class='line'>182</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>183</span>    * traversing the current object.
<span class='line'>184</span>    *
<span class='line'>185</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>186</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>187</span>    *
<span class='line'>188</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>189</span>    *
<span class='line'>190</span>    * @see $.js.Array.forEach
<span class='line'>191</span>    */</span><span class="WHIT">
<span class='line'>192</span> </span><span class="WHIT">  </span><span class="NAME">forEach</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>194</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>195</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>196</span> 
<span class='line'>197</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.propertyIsEnumerable</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">        </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>203</span> 
<span class='line'>204</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>205</span>    * Check if the &lt;var>callback&lt;/var> function returns true for every property 
<span class='line'>206</span>    * in the current object.
<span class='line'>207</span>    *
<span class='line'>208</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each property in the 
<span class='line'>209</span>    * current object, and it is given three arguments: the value, the property 
<span class='line'>210</span>    * name, and the entire object being iterated over.
<span class='line'>211</span>    *
<span class='line'>212</span>    * &lt;p>Iteration over the object stops once reaching the end, or once the 
<span class='line'>213</span>    * &lt;var>callback&lt;/var> function returns false.
<span class='line'>214</span>    *
<span class='line'>215</span>    * &lt;p>This method does not alter the current object.
<span class='line'>216</span>    *
<span class='line'>217</span>    * @example
<span class='line'>218</span>    * &lt;code>var &lt;var>obj&lt;/var> = {'a' : 10, 'b' : 11, 'c' : 12};&lt;/code>
<span class='line'>219</span>    *
<span class='line'>220</span>    * // The following returns true.
<span class='line'>221</span>    * &lt;code>&lt;var>obj&lt;/var>.every(function (&lt;var>value&lt;/var>) {
<span class='line'>222</span>    *   return &lt;var>value&lt;/var> &gt; 9;
<span class='line'>223</span>    * });&lt;/code>
<span class='line'>224</span>    *
<span class='line'>225</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>226</span>    * traversing the current object.
<span class='line'>227</span>    *
<span class='line'>228</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>229</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>230</span>    *
<span class='line'>231</span>    * @returns {Boolean} False is returned if the &lt;var>callback&lt;/var> returns 
<span class='line'>232</span>    * false once. Otherwise, this method returns true.
<span class='line'>233</span>    *
<span class='line'>234</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>235</span>    *
<span class='line'>236</span>    * @see $.js.Array.every
<span class='line'>237</span>    */</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">  </span><span class="NAME">every</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>242</span> 
<span class='line'>243</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.propertyIsEnumerable</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='line'>245</span>             </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>247</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>249</span> 
<span class='line'>250</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>252</span> 
<span class='line'>253</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>254</span>    * Check if the &lt;var>callback&lt;/var> function returns true for at least one 
<span class='line'>255</span>    * property in the current object.
<span class='line'>256</span>    *
<span class='line'>257</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each property in the 
<span class='line'>258</span>    * current object, and it is given three arguments: the value, the property 
<span class='line'>259</span>    * name, and the entire object being iterated over.
<span class='line'>260</span>    *
<span class='line'>261</span>    * &lt;p>Iteration over the object stops once reaching the end, or once the 
<span class='line'>262</span>    * &lt;var>callback&lt;/var> function returns true.
<span class='line'>263</span>    *
<span class='line'>264</span>    * &lt;p>This method does not alter the current object.
<span class='line'>265</span>    *
<span class='line'>266</span>    * @example
<span class='line'>267</span>    * &lt;code>var &lt;var>obj&lt;/var> = {'a' : 10, 'b' : 11, 'c' : 12};&lt;/code>
<span class='line'>268</span>    *
<span class='line'>269</span>    * // The following returns true.
<span class='line'>270</span>    * &lt;code>&lt;var>obj&lt;/var>.some(function (&lt;var>value&lt;/var>) {
<span class='line'>271</span>    *   return &lt;var>value&lt;/var> &gt; 11;
<span class='line'>272</span>    * });&lt;/code>
<span class='line'>273</span>    *
<span class='line'>274</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>275</span>    * traversing the current object.
<span class='line'>276</span>    *
<span class='line'>277</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>278</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>279</span>    *
<span class='line'>280</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>281</span>    *
<span class='line'>282</span>    * @returns {Boolean} True is returned if the &lt;var>callback&lt;/var> returns true 
<span class='line'>283</span>    * once. Otherwise, this method returns false.
<span class='line'>284</span>    *
<span class='line'>285</span>    * @see $.js.Array.some
<span class='line'>286</span>    */</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">  </span><span class="NAME">some</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>291</span> 
<span class='line'>292</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.propertyIsEnumerable</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='line'>294</span>             </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>298</span> 
<span class='line'>299</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>301</span> 
<span class='line'>302</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>303</span>    * Create a new object with the same properties as the current object using 
<span class='line'>304</span>    * the values returned by the &lt;var>callback&lt;/var> function.
<span class='line'>305</span>    *
<span class='line'>306</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each property in the 
<span class='line'>307</span>    * current object, and it is given three arguments: the value, the property 
<span class='line'>308</span>    * name, and the entire object being iterated over.
<span class='line'>309</span>    *
<span class='line'>310</span>    * &lt;p>This method does not alter the current object.
<span class='line'>311</span>    *
<span class='line'>312</span>    * @example
<span class='line'>313</span>    * &lt;code>var &lt;var>obj1&lt;/var> = {'a' : 5, 'b' : 11, 'c' : 7};&lt;/code>
<span class='line'>314</span>    *
<span class='line'>315</span>    * // Let's double the numbers:
<span class='line'>316</span>    * &lt;code>var &lt;var>obj2&lt;/var> = &lt;var>obj1&lt;/var>.map(function (&lt;var>value&lt;/var>) {
<span class='line'>317</span>    *   return &lt;var>value&lt;/var> * 2;
<span class='line'>318</span>    * });&lt;/code>
<span class='line'>319</span>    *
<span class='line'>320</span>    * // Now &lt;code>&lt;var>obj2&lt;/var> = {'a' : 10, 'b' : 22, 'c' : 14}&lt;/code>.
<span class='line'>321</span>    *
<span class='line'>322</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>323</span>    * traversing the current object.
<span class='line'>324</span>    *
<span class='line'>325</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>326</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>327</span>    *
<span class='line'>328</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>329</span>    *
<span class='line'>330</span>    * @returns {Object} The new object has the same properties as the current 
<span class='line'>331</span>    * object, but the values are those returned by the &lt;var>callback&lt;/var> 
<span class='line'>332</span>    * function.
<span class='line'>333</span>    *
<span class='line'>334</span>    * @see $.js.Array.map
<span class='line'>335</span>    */</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">  </span><span class="NAME">map</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>338</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>339</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>340</span> 
<span class='line'>341</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> 
<span class='line'>343</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.propertyIsEnumerable</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT">        </span><span class="NAME">resObj</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>346</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>348</span> 
<span class='line'>349</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">resObj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>351</span> 
<span class='line'>352</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>353</span>    * Apply the &lt;var>callback&lt;/var> function to two values from the current 
<span class='line'>354</span>    * object, simultaneously, for the purpose of reducing the object to a single 
<span class='line'>355</span>    * value.
<span class='line'>356</span>    *
<span class='line'>357</span>    * &lt;p>The &lt;var>callback&lt;/var> function is called for each property in the 
<span class='line'>358</span>    * current object, and it is given four arguments: the previous value, the 
<span class='line'>359</span>    * current value, the current property name, and the entire object being 
<span class='line'>360</span>    * iterated over.
<span class='line'>361</span>    *
<span class='line'>362</span>    * &lt;p>This method does not alter the current object.
<span class='line'>363</span>    *
<span class='line'>364</span>    * &lt;p>Note that the execution order is the same as doing &lt;code>for (prop in 
<span class='line'>365</span>    * obj)&lt;/code>.
<span class='line'>366</span>    *
<span class='line'>367</span>    * @example
<span class='line'>368</span>    * &lt;code>var &lt;var>obj&lt;/var> = {'a' : 5, 'b' : 10, 'c' : 6};&lt;/code>
<span class='line'>369</span>    *
<span class='line'>370</span>    * // Let's calculate the sum:
<span class='line'>371</span>    * &lt;code>var &lt;var>result&lt;/var> = &lt;var>obj&lt;/var>.reduce(
<span class='line'>372</span>    *   function (&lt;var>sum&lt;/var>, &lt;var>value&lt;/var>) {
<span class='line'>373</span>    *     return &lt;var>sum&lt;/var> + &lt;var>value&lt;/var>;
<span class='line'>374</span>    *   },
<span class='line'>375</span>    * 0);&lt;/code>
<span class='line'>376</span>    *
<span class='line'>377</span>    * // Now &lt;var>result&lt;/var> = 21.
<span class='line'>378</span>    *
<span class='line'>379</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>380</span>    * traversing the current object.
<span class='line'>381</span>    *
<span class='line'>382</span>    * @param [initialValue] The initial value used when the &lt;var>callback&lt;/var> 
<span class='line'>383</span>    * function is first invoked. If the initial value is not provided, then the 
<span class='line'>384</span>    * method uses the value of the first property found in the object being 
<span class='line'>385</span>    * iterated.
<span class='line'>386</span>    *
<span class='line'>387</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>388</span>    *
<span class='line'>389</span>    * @returns The result of the last &lt;var>callback&lt;/var> function invocation.
<span class='line'>390</span>    *
<span class='line'>391</span>    * @see $.js.Array.reduce
<span class='line'>392</span>    * @see $.js.Array.reduceRight
<span class='line'>393</span>    */</span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">  </span><span class="NAME">reduce</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>396</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>397</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>398</span> 
<span class='line'>399</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>400</span> 
<span class='line'>401</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>402</span> </span><span class="WHIT">      </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>403</span> </span><span class="WHIT">      </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>404</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>405</span> 
<span class='line'>406</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>407</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.propertyIsEnumerable</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>408</span> </span><span class="WHIT">        </span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>409</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>410</span> 
<span class='line'>411</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">found_initial</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>412</span> </span><span class="WHIT">        </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>413</span> </span><span class="WHIT">        </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>414</span> </span><span class="WHIT">        </span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>415</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>416</span> 
<span class='line'>417</span> </span><span class="WHIT">      </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>419</span> 
<span class='line'>420</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>421</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>422</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>423</span> 
<span class='line'>424</span> </span><span class="COMM">/**
<span class='line'>425</span>  * Holds the methods used for manipulating arrays and other array-like objects.
<span class='line'>426</span>  * 
<span class='line'>427</span>  * &lt;p>These methods are very similar to their Object counter-parts. Also, most 
<span class='line'>428</span>  * of the methods (if not all) are already implemented natively in the global 
<span class='line'>429</span>  * &lt;var>Array.prototype&lt;/var> object (new in JavaScript 1.6).
<span class='line'>430</span>  *
<span class='line'>431</span>  * &lt;p>By default, the global &lt;var>Array.prototype&lt;/var> object is extended to 
<span class='line'>432</span>  * contain all the methods in this namespace, if they do not exists already.  
<span class='line'>433</span>  * Thus, native Array methods are not overwritten.
<span class='line'>434</span>  *
<span class='line'>435</span>  * &lt;p>All of these methods use their &lt;var>this&lt;/var> object. As such, you need 
<span class='line'>436</span>  * to pass the correct &lt;var>this&lt;/var> object.
<span class='line'>437</span>  *
<span class='line'>438</span>  * &lt;p>Note that the methods provided iterate over the object properties using 
<span class='line'>439</span>  * &lt;code>for (var &lt;var>i&lt;/var> = 0; &lt;var>i&lt;/var> &lt; &lt;var>this&lt;/var>.length; 
<span class='line'>440</span>  * &lt;var>i&lt;/var>++) { ... &lt;var>this[i]&lt;/var> ... }&lt;/code>. As such, any object 
<span class='line'>441</span>  * can be used if it provides index-based access to its properties, together 
<span class='line'>442</span>  * with the &lt;var>length&lt;/var> property. 
<span class='line'>443</span>  *
<span class='line'>444</span>  * &lt;p>The implementations do minimal type checks, such that the methods can be 
<span class='line'>445</span>  * used together with NodeLists and other Array-like objects.
<span class='line'>446</span>  *
<span class='line'>447</span>  * &lt;p>In the examples provided for each method we will assume that the arrays 
<span class='line'>448</span>  * defined already have the methods. Thus code like 
<span class='line'>449</span>  * &lt;code>&lt;var>array&lt;/var>.filter(&lt;var>callback&lt;/var>)&lt;/code> can be written 
<span class='line'>450</span>  * directly.
<span class='line'>451</span>  *
<span class='line'>452</span>  * @example
<span class='line'>453</span>  * // To use these methods with a NodeList proceed as follows:
<span class='line'>454</span>  *
<span class='line'>455</span>  * &lt;code>var &lt;var>nodes&lt;/var> = document.body.childNodes;
<span class='line'>456</span>  *
<span class='line'>457</span>  * $.js.Array.forEach.call(&lt;var>nodes&lt;/var>, function (&lt;var>node&lt;/var>) {
<span class='line'>458</span>  *   // ...
<span class='line'>459</span>  * });&lt;/code>
<span class='line'>460</span>  *
<span class='line'>461</span>  * // Instead of forEach, you can use any of the methods defined in this
<span class='line'>462</span>  * // namespace.
<span class='line'>463</span>  *
<span class='line'>464</span>  * @example
<span class='line'>465</span>  * Additionally, you can extend your object to have all these methods:
<span class='line'>466</span>  *
<span class='line'>467</span>  * &lt;code>$.extend.call(NodeList, $.js.Array);&lt;/code>
<span class='line'>468</span>  *
<span class='line'>469</span>  * // After doing so, you can directly use any desired method.
<span class='line'>470</span>  * // For example:
<span class='line'>471</span>  * &lt;code>&lt;var>nodes&lt;/var>.forEach(&lt;var>callback&lt;/var>)&lt;/code>.
<span class='line'>472</span>  *
<span class='line'>473</span>  * @namespace Holds the methods used for manipulating arrays and other 
<span class='line'>474</span>  * array-like objects.
<span class='line'>475</span>  *
<span class='line'>476</span>  * @see $.js.Object The Object methods which provide similar functionality for 
<span class='line'>477</span>  * objects.
<span class='line'>478</span>  */</span><span class="WHIT">
<span class='line'>479</span> </span><span class="NAME">$.js.Array</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>480</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>481</span>    * Extract a section of the current array and return it.
<span class='line'>482</span>    *
<span class='line'>483</span>    * @example
<span class='line'>484</span>    * &lt;code>var &lt;var>arr1&lt;/var> = ['a', 'b', 'c', 'd'];
<span class='line'>485</span>    * var &lt;var>arr2&lt;/var> = &lt;var>arr1&lt;/var>.slice(1, 3);&lt;/code>
<span class='line'>486</span>    * // Now &lt;code>&lt;var>arr2&lt;/var> = ['b', 'c']&lt;/code>.
<span class='line'>487</span>    *
<span class='line'>488</span>    * &lt;code>var &lt;var>arr3&lt;/var> = &lt;var>arr1&lt;/var>.slice(1);&lt;/code>
<span class='line'>489</span>    * // Now &lt;code>&lt;var>arr3&lt;/var> = ['b', 'c', 'd']&lt;/code>.
<span class='line'>490</span>    *
<span class='line'>491</span>    * &lt;code>var &lt;var>arr4&lt;/var> = &lt;var>arr1&lt;/var>.slice(0, -2);&lt;/code>
<span class='line'>492</span>    * // Now &lt;code>&lt;var>arr4&lt;/var> = ['a', 'b']&lt;/code>.
<span class='line'>493</span>    *
<span class='line'>494</span>    * @param {Number} begin Zero-based index from where to start the extraction 
<span class='line'>495</span>    * of array elements.
<span class='line'>496</span>    *
<span class='line'>497</span>    * @param {Number} [end=this.length] Zero-based index where to end the 
<span class='line'>498</span>    * extraction of array elements.
<span class='line'>499</span>    * 
<span class='line'>500</span>    * &lt;p>If the argument is not given, then the end is considered the array 
<span class='line'>501</span>    * length. Thus, the slice being extracted contains all the array elements 
<span class='line'>502</span>    * from the given &lt;var>begin&lt;/var> index.
<span class='line'>503</span>    * 
<span class='line'>504</span>    * &lt;p>If the number is negative, then the &lt;var>end&lt;/var> index is calculated 
<span class='line'>505</span>    * by a simple formula: &lt;code>&lt;var>end&lt;/var> = &lt;var>array.length&lt;/var> 
<span class='line'>506</span>    * - &lt;var>end&lt;/var>&lt;/code>. Thus, given a negative index like -3, it would 
<span class='line'>507</span>    *   mean that the slice being extracted will not contain the last three 
<span class='line'>508</span>    *   elements.
<span class='line'>509</span>    *
<span class='line'>510</span>    * @throws {TypeError} If &lt;var>begin&lt;/var> is not a number, or if it is 
<span class='line'>511</span>    * a negative number.
<span class='line'>512</span>    *
<span class='line'>513</span>    * @throws {TypeError} If &lt;var>end&lt;/var> is provided, but it is not a number.
<span class='line'>514</span>    *
<span class='line'>515</span>    * @returns {Array} The new array returned contains all the elements starting 
<span class='line'>516</span>    * from the &lt;var>begin&lt;/var> index (including it) up to the &lt;var>end&lt;/var> 
<span class='line'>517</span>    * index (excluding it).
<span class='line'>518</span>    */</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">  </span><span class="NAME">slice</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">begin</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">end</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>520</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">begin</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">begin</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>521</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">"The first argument is not a valid number."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>522</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">end</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>523</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">"The second argument is not a valid number."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>524</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>525</span> 
<span class='line'>526</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">begin</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>527</span> 
<span class='line'>528</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>529</span> </span><span class="WHIT">      </span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">end</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>530</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>531</span> 
<span class='line'>532</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">      </span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>534</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>535</span> 
<span class='line'>536</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">end</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT">      </span><span class="NAME">resArr.push</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>538</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>539</span> 
<span class='line'>540</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>541</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>542</span> 
<span class='line'>543</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>544</span>    * Join all the elements from the current array into a single string using 
<span class='line'>545</span>    * a separator.
<span class='line'>546</span>    *
<span class='line'>547</span>    * &lt;p>Each element of the array is converted to a string using the automatic 
<span class='line'>548</span>    * &lt;code>toString()&lt;/code> method invocation. A string separator is added into 
<span class='line'>549</span>    * the result string between each array element.
<span class='line'>550</span>    *
<span class='line'>551</span>    * &lt;p>This method does not alter the current array.
<span class='line'>552</span>    *
<span class='line'>553</span>    * @example
<span class='line'>554</span>    * &lt;code>var &lt;var>arr&lt;/var> = ['a', 'b', 'c'];
<span class='line'>555</span>    * var &lt;var>str&lt;/var> = &lt;var>arr&lt;/var>.join('-');&lt;/code>
<span class='line'>556</span>    *
<span class='line'>557</span>    * // Now &lt;code>&lt;var>str&lt;/var> = 'a-b-c'&lt;/code>.
<span class='line'>558</span>    *
<span class='line'>559</span>    * @param {String} [separator] The separator string which gets added between 
<span class='line'>560</span>    * each array element into the result string. If the argument is not provided, 
<span class='line'>561</span>    * then a comma will be used.
<span class='line'>562</span>    *
<span class='line'>563</span>    * @returns {String} The new string containing all the elements in the current 
<span class='line'>564</span>    * array, converted into strings, separated by the given &lt;var>separator&lt;/var>.
<span class='line'>565</span>    */</span><span class="WHIT">
<span class='line'>566</span> </span><span class="WHIT">  </span><span class="NAME">join</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">separator</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>567</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">separator</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>568</span> </span><span class="WHIT">      </span><span class="NAME">separator</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">','</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>569</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>570</span> 
<span class='line'>571</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>572</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>573</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>574</span> </span><span class="WHIT">        </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">separator</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>575</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>576</span> </span><span class="WHIT">      </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>577</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>578</span> 
<span class='line'>579</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>580</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>581</span> 
<span class='line'>582</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>583</span>    * Concatenate multiple arrays.
<span class='line'>584</span>    *
<span class='line'>585</span>    * &lt;p>This method takes any number of arguments.
<span class='line'>586</span>    *
<span class='line'>587</span>    * @example
<span class='line'>588</span>    * &lt;code>var &lt;var>arr1&lt;/var> = [5, 11, 7];
<span class='line'>589</span>    * var &lt;var>arr2&lt;/var> = &lt;var>arr1&lt;/var>.concat('test', [1, 2, 3], 4);&lt;/code>
<span class='line'>590</span>    *
<span class='line'>591</span>    * // Now &lt;code>&lt;var>arr2&lt;/var> = [5, 11, 7, 'test', 1, 2, 3, 4]&lt;/code>.
<span class='line'>592</span>    *
<span class='line'>593</span>    * @param value1 Array/value to concatenate.
<span class='line'>594</span>    * @param [valueN] Array/value to concatenate.
<span class='line'>595</span>    *
<span class='line'>596</span>    * @returns {Array} The result is a new array consisting of:
<span class='line'>597</span>    * &lt;ol>
<span class='line'>598</span>    *   &lt;li>the &lt;var>this&lt;/var> array object on which the &lt;code>concat&lt;/code> 
<span class='line'>599</span>    *   method was called;
<span class='line'>600</span>    *   &lt;li>each element of the arrays passed as arguments;
<span class='line'>601</span>    *   &lt;li>if an argument is not an array, then the argument value is added 
<span class='line'>602</span>    *   as-is.
<span class='line'>603</span>    * &lt;/ol>
<span class='line'>604</span>    *
<span class='line'>605</span>    * &lt;p>The current array is not altered, nor the arrays passed as arguments.
<span class='line'>606</span>    */</span><span class="WHIT">
<span class='line'>607</span> </span><span class="WHIT">  </span><span class="NAME">concat</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>608</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>609</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>610</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>611</span> </span><span class="WHIT">        </span><span class="NAME">arr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>612</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>613</span> </span><span class="WHIT">        </span><span class="NAME">arr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>614</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>615</span> 
<span class='line'>616</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">arr.length</span><span class="WHIT">  </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">arr.length</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>617</span> </span><span class="WHIT">        </span><span class="NAME">resArr.push</span><span class="PUNC">(</span><span class="NAME">arrr</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>618</span> </span><span class="WHIT">        </span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>619</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>620</span> 
<span class='line'>621</span> </span><span class="WHIT">      </span><span class="NAME">m</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arr.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>622</span> </span><span class="WHIT">      </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">y</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>623</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">y</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">arr</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>624</span> </span><span class="WHIT">          </span><span class="NAME">resArr.push</span><span class="PUNC">(</span><span class="NAME">arr</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>625</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>626</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>627</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>628</span> 
<span class='line'>629</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>630</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>631</span> 
<span class='line'>632</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>633</span>    * Filter the current array using the &lt;var>callback&lt;/var> function.
<span class='line'>634</span>    *
<span class='line'>635</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each element in the 
<span class='line'>636</span>    * current array, and it is given three arguments: the value, the index, and 
<span class='line'>637</span>    * the entire array being iterated over.
<span class='line'>638</span>    *
<span class='line'>639</span>    * &lt;p>This method does not alter the current array.
<span class='line'>640</span>    *
<span class='line'>641</span>    * @example
<span class='line'>642</span>    * &lt;code>var &lt;var>arr1&lt;/var> = [5, 11, 7];&lt;/code>
<span class='line'>643</span>    *
<span class='line'>644</span>    * // Filter only the elements with a value lower than 10:
<span class='line'>645</span>    *
<span class='line'>646</span>    * &lt;code>var &lt;var>arr2&lt;/var> = &lt;var>arr1&lt;/var>.filter(
<span class='line'>647</span>    *   function (&lt;var>value&lt;/var>, &lt;var>index&lt;/var>, &lt;var>array&lt;/var>) {
<span class='line'>648</span>    *     return &lt;var>value&lt;/var> &lt; 10;
<span class='line'>649</span>    *   }
<span class='line'>650</span>    * );&lt;/code>
<span class='line'>651</span>    *
<span class='line'>652</span>    * // Now &lt;code>&lt;var>arr2&lt;/var> = [5, 7]&lt;/code>.
<span class='line'>653</span>    *
<span class='line'>654</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>655</span>    * filtering the current array.
<span class='line'>656</span>    *
<span class='line'>657</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>658</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>659</span>    *
<span class='line'>660</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>661</span>    *
<span class='line'>662</span>    * @returns {Array} The new array contains only the elements for which the 
<span class='line'>663</span>    * &lt;var>callback&lt;/var> function returned true.
<span class='line'>664</span>    *
<span class='line'>665</span>    * @see $.js.Object.filter
<span class='line'>666</span>    */</span><span class="WHIT">
<span class='line'>667</span> </span><span class="WHIT">  </span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>668</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>669</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>670</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>671</span> 
<span class='line'>672</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>673</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>674</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>675</span> </span><span class="WHIT">        </span><span class="NAME">resArr.push</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>676</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>677</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>678</span> 
<span class='line'>679</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>680</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>681</span> 
<span class='line'>682</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>683</span>    * Execute the &lt;var>callback&lt;/var> function for each element in the current 
<span class='line'>684</span>    * array.
<span class='line'>685</span>    *
<span class='line'>686</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked with three arguments: the 
<span class='line'>687</span>    * value, the index, and the entire array being iterated over.
<span class='line'>688</span>    *
<span class='line'>689</span>    * &lt;p>This method does not alter the current array.
<span class='line'>690</span>    *
<span class='line'>691</span>    * @example
<span class='line'>692</span>    * &lt;code>var &lt;var>arr&lt;/var> = [10, 11, 12];&lt;/code>
<span class='line'>693</span>    *
<span class='line'>694</span>    * // alert() each index and value.
<span class='line'>695</span>    * &lt;code>&lt;var>arr&lt;/var>.forEach(
<span class='line'>696</span>    *   function (&lt;var>value&lt;/var>, &lt;var>index&lt;/var>) {
<span class='line'>697</span>    *     alert(&lt;var>index&lt;/var> + ' : ' + &lt;var>value&lt;/var>);
<span class='line'>698</span>    *   }
<span class='line'>699</span>    * );&lt;/code>
<span class='line'>700</span>    *
<span class='line'>701</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>702</span>    * traversing the current array.
<span class='line'>703</span>    *
<span class='line'>704</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>705</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>706</span>    *
<span class='line'>707</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>708</span>    *
<span class='line'>709</span>    * @see $.js.Object.forEach
<span class='line'>710</span>    */</span><span class="WHIT">
<span class='line'>711</span> </span><span class="WHIT">  </span><span class="NAME">forEach</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>712</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>713</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>714</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>715</span> 
<span class='line'>716</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>717</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>718</span> </span><span class="WHIT">        </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>719</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>720</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>721</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>722</span> 
<span class='line'>723</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>724</span>    * Check if the &lt;var>callback&lt;/var> function returns true for every element in 
<span class='line'>725</span>    * the current array.
<span class='line'>726</span>    *
<span class='line'>727</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each element in the 
<span class='line'>728</span>    * current array, and it is given three arguments: the value, the index, and 
<span class='line'>729</span>    * the entire array being iterated over.
<span class='line'>730</span>    *
<span class='line'>731</span>    * &lt;p>Iteration over the array stops once reaching the end, or once the 
<span class='line'>732</span>    * &lt;var>callback&lt;/var> function returns false.
<span class='line'>733</span>    *
<span class='line'>734</span>    * &lt;p>This method does not alter the current array.
<span class='line'>735</span>    *
<span class='line'>736</span>    * @example
<span class='line'>737</span>    * &lt;code>var &lt;var>arr&lt;/var> = [10, 11, 12];&lt;/code>
<span class='line'>738</span>    *
<span class='line'>739</span>    * // The following returns true.
<span class='line'>740</span>    * &lt;code>&lt;var>arr&lt;/var>.every(function (&lt;var>value&lt;/var>) {
<span class='line'>741</span>    *   return &lt;var>value&lt;/var> &gt; 9;
<span class='line'>742</span>    * });&lt;/code>
<span class='line'>743</span>    *
<span class='line'>744</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>745</span>    * traversing the current array.
<span class='line'>746</span>    *
<span class='line'>747</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>748</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>749</span>    *
<span class='line'>750</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>751</span>    *
<span class='line'>752</span>    * @returns {Boolean} False is returned if the &lt;var>callback&lt;/var> returns 
<span class='line'>753</span>    * false once. Otherwise, this method returns true.
<span class='line'>754</span>    *
<span class='line'>755</span>    * @see $.js.Object.every
<span class='line'>756</span>    */</span><span class="WHIT">
<span class='line'>757</span> </span><span class="WHIT">  </span><span class="NAME">every</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>758</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>759</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>760</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>761</span> 
<span class='line'>762</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>763</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>764</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>765</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>766</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>767</span> 
<span class='line'>768</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>769</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>770</span> 
<span class='line'>771</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>772</span>    * Check if the &lt;var>callback&lt;/var> function returns true for at least one 
<span class='line'>773</span>    * element in the current array.
<span class='line'>774</span>    *
<span class='line'>775</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each element in the 
<span class='line'>776</span>    * current array, and it is given three arguments: the value, the index, and 
<span class='line'>777</span>    * the entire array being iterated over.
<span class='line'>778</span>    *
<span class='line'>779</span>    * &lt;p>Iteration over the array stops once reaching the end, or once the 
<span class='line'>780</span>    * &lt;var>callback&lt;/var> function returns true.
<span class='line'>781</span>    *
<span class='line'>782</span>    * &lt;p>This method does not alter the current array.
<span class='line'>783</span>    *
<span class='line'>784</span>    * @example
<span class='line'>785</span>    * &lt;code>var &lt;var>arr&lt;/var> = [10, 11, 12];&lt;/code>
<span class='line'>786</span>    *
<span class='line'>787</span>    * // The following returns true.
<span class='line'>788</span>    * &lt;code>&lt;var>arr&lt;/var>.some(function (&lt;var>value&lt;/var>) {
<span class='line'>789</span>    *   return &lt;var>value&lt;/var> &gt; 11;
<span class='line'>790</span>    * });&lt;/code>
<span class='line'>791</span>    *
<span class='line'>792</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>793</span>    * traversing the current array.
<span class='line'>794</span>    *
<span class='line'>795</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>796</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>797</span>    *
<span class='line'>798</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>799</span>    *
<span class='line'>800</span>    * @returns {Boolean} True is returned if the &lt;var>callback&lt;/var> returns true 
<span class='line'>801</span>    * once. Otherwise, this method returns false.
<span class='line'>802</span>    *
<span class='line'>803</span>    * @see $.js.Object.some
<span class='line'>804</span>    */</span><span class="WHIT">
<span class='line'>805</span> </span><span class="WHIT">  </span><span class="NAME">some</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>806</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>807</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>808</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>809</span> 
<span class='line'>810</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>811</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>812</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>813</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>814</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>815</span> 
<span class='line'>816</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>817</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>818</span> 
<span class='line'>819</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>820</span>    * Create a new array with the same length as the current array using the 
<span class='line'>821</span>    * values returned by the &lt;var>callback&lt;/var> function.
<span class='line'>822</span>    *
<span class='line'>823</span>    * &lt;p>The &lt;var>callback&lt;/var> function is invoked for each element in the 
<span class='line'>824</span>    * current array, and it is given three arguments: the value, the index, and 
<span class='line'>825</span>    * the entire array being iterated over.
<span class='line'>826</span>    *
<span class='line'>827</span>    * &lt;p>This method does not alter the current array.
<span class='line'>828</span>    *
<span class='line'>829</span>    * @example
<span class='line'>830</span>    * &lt;code>var &lt;var>arr1&lt;/var> = [5, 11, 7];&lt;/code>
<span class='line'>831</span>    *
<span class='line'>832</span>    * // Let's double the numbers:
<span class='line'>833</span>    * &lt;code>var &lt;var>arr2&lt;/var> = &lt;var>arr1&lt;/var>.map(function (&lt;var>value&lt;/var>) {
<span class='line'>834</span>    *   return &lt;var>value&lt;/var> * 2;
<span class='line'>835</span>    * });&lt;/code>
<span class='line'>836</span>    *
<span class='line'>837</span>    * // Now &lt;code>&lt;var>arr2&lt;/var> = [10, 22, 14]&lt;/code>.
<span class='line'>838</span>    *
<span class='line'>839</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>840</span>    * traversing the current array.
<span class='line'>841</span>    *
<span class='line'>842</span>    * @param {Object} [thisObject] The object which will be the &lt;var>this&lt;/var> 
<span class='line'>843</span>    * within the scope of the &lt;var>callback&lt;/var> function, for each invocation.
<span class='line'>844</span>    *
<span class='line'>845</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>846</span>    *
<span class='line'>847</span>    * @returns {Array} The new array has the same length as the current array, 
<span class='line'>848</span>    * but the values are those returned by the &lt;var>callback&lt;/var> function.
<span class='line'>849</span>    *
<span class='line'>850</span>    * @see $.js.Object.map
<span class='line'>851</span>    */</span><span class="WHIT">
<span class='line'>852</span> </span><span class="WHIT">  </span><span class="NAME">map</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">thisObject</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>853</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>854</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>855</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>856</span> 
<span class='line'>857</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>858</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>859</span> 
<span class='line'>860</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>861</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>862</span> </span><span class="WHIT">        </span><span class="NAME">resArr</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="NAME">thisObject</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>863</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>864</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>865</span> 
<span class='line'>866</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">resArr</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>867</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>868</span> 
<span class='line'>869</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>870</span>    * Apply the &lt;var>callback&lt;/var> function to two values from the current 
<span class='line'>871</span>    * array, from left to right, simultaneously, for the purpose of reducing the 
<span class='line'>872</span>    * array to a single value.
<span class='line'>873</span>    *
<span class='line'>874</span>    * &lt;p>The &lt;var>callback&lt;/var> function is called for each element in the 
<span class='line'>875</span>    * current array, and it is given four arguments: the previous value, the 
<span class='line'>876</span>    * current value, the current index, and the entire array being iterated over.
<span class='line'>877</span>    *
<span class='line'>878</span>    * &lt;p>This method does not alter the current array.
<span class='line'>879</span>    *
<span class='line'>880</span>    * &lt;p>Iteration starts from the first element in the current array (index 0) 
<span class='line'>881</span>    * going up to the last element (&lt;code>array.length-1&lt;/code>), one by one.
<span class='line'>882</span>    *
<span class='line'>883</span>    * @example
<span class='line'>884</span>    * &lt;code>var &lt;var>arr&lt;/var> = [5, 10, 6];&lt;/code>
<span class='line'>885</span>    *
<span class='line'>886</span>    * // Let's calculate the sum:
<span class='line'>887</span>    * &lt;code>var &lt;var>result&lt;/var> = &lt;var>arr&lt;/var>.reduce(
<span class='line'>888</span>    *   function (&lt;var>sum&lt;/var>, &lt;var>value&lt;/var>) {
<span class='line'>889</span>    *     return &lt;var>sum&lt;/var> + &lt;var>value&lt;/var>;
<span class='line'>890</span>    *   },
<span class='line'>891</span>    * 0);&lt;/code>
<span class='line'>892</span>    *
<span class='line'>893</span>    * // Now &lt;var>result&lt;/var> = 21.
<span class='line'>894</span>    *
<span class='line'>895</span>    * @param {Function} callback The &lt;var>callback&lt;/var> function used for 
<span class='line'>896</span>    * traversing the current array.
<span class='line'>897</span>    *
<span class='line'>898</span>    * @param [initialValue] The initial value used when the &lt;var>callback&lt;/var> 
<span class='line'>899</span>    * function is first invoked. If the initial value is not provided, then the 
<span class='line'>900</span>    * method uses the value of the first element found in the array being 
<span class='line'>901</span>    * iterated.
<span class='line'>902</span>    *
<span class='line'>903</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>904</span>    *
<span class='line'>905</span>    * @returns The result of the last &lt;var>callback&lt;/var> function invocation.
<span class='line'>906</span>    *
<span class='line'>907</span>    * @see $.js.Array.reduceRight
<span class='line'>908</span>    * @see $.js.Object.reduce
<span class='line'>909</span>    */</span><span class="WHIT">
<span class='line'>910</span> </span><span class="WHIT">  </span><span class="NAME">reduce</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>911</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>912</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>913</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>914</span> 
<span class='line'>915</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>916</span> 
<span class='line'>917</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>918</span> </span><span class="WHIT">      </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>919</span> </span><span class="WHIT">      </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>920</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>921</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>922</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>923</span> 
<span class='line'>924</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>925</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>926</span> </span><span class="WHIT">        </span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>927</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>928</span> 
<span class='line'>929</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">found_initial</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>930</span> </span><span class="WHIT">        </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>931</span> </span><span class="WHIT">        </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>932</span> </span><span class="WHIT">        </span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>933</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>934</span> 
<span class='line'>935</span> </span><span class="WHIT">      </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>936</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>937</span> 
<span class='line'>938</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">found_initial</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>939</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>940</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>941</span> 
<span class='line'>942</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>943</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>944</span> 
<span class='line'>945</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>946</span>    * Apply the &lt;var>callback&lt;/var> function to two values from the current 
<span class='line'>947</span>    * array, from right to left, simultaneously, for the purpose of reducing the 
<span class='line'>948</span>    * array to a single value.
<span class='line'>949</span>    *
<span class='line'>950</span>    * &lt;p>The &lt;var>callback&lt;/var> function is called for each element in the 
<span class='line'>951</span>    * current array, and it is given four arguments: the previous value, the 
<span class='line'>952</span>    * current value, the current index, and the entire array being iterated over.
<span class='line'>953</span>    *
<span class='line'>954</span>    * &lt;p>This method does not alter the current array.
<span class='line'>955</span>    *
<span class='line'>956</span>    * &lt;p>Iteration starts from the last element in the current array 
<span class='line'>957</span>    * (&lt;code>array.length-1&lt;/code>) going down to 0, the first element, one by 
<span class='line'>958</span>    * one.
<span class='line'>959</span>    *
<span class='line'>960</span>    * @example
<span class='line'>961</span>    * &lt;code>var arr = [5, 10, 6];&lt;/code>
<span class='line'>962</span>    *
<span class='line'>963</span>    * // Let's calculate the sum:
<span class='line'>964</span>    * &lt;code>var result = arr.reduce(function (&lt;var>sum&lt;/var>, &lt;var>value&lt;/var>) {
<span class='line'>965</span>    *   return &lt;var>sum&lt;/var> + &lt;var>value&lt;/var>;
<span class='line'>966</span>    * }, 0);&lt;/code>
<span class='line'>967</span>    *
<span class='line'>968</span>    * // Now result = 21.
<span class='line'>969</span>    *
<span class='line'>970</span>    * @param {Function} callback The callback function used for traversing the 
<span class='line'>971</span>    * current array.
<span class='line'>972</span>    *
<span class='line'>973</span>    * @param [initialValue] The initial value used when the &lt;var>callback&lt;/var> 
<span class='line'>974</span>    * function is first invoked. If the initial value is not provided, then the 
<span class='line'>975</span>    * method uses the value of the last element found in the array being 
<span class='line'>976</span>    * iterated.
<span class='line'>977</span>    *
<span class='line'>978</span>    * @throws {TypeError} If &lt;var>callback&lt;/var> is not a function.
<span class='line'>979</span>    *
<span class='line'>980</span>    * @returns The result of the last &lt;var>callback&lt;/var> function invocation.
<span class='line'>981</span>    *
<span class='line'>982</span>    * @see $.js.Array.reduce
<span class='line'>983</span>    * @see $.js.Object.reduce
<span class='line'>984</span>    */</span><span class="WHIT">
<span class='line'>985</span> </span><span class="WHIT">  </span><span class="NAME">reduceRight</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>986</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>987</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument must be a function.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>988</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>989</span> 
<span class='line'>990</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>991</span> 
<span class='line'>992</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>993</span> </span><span class="WHIT">      </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>994</span> </span><span class="WHIT">      </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">initialValue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>995</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>996</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>997</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>998</span> 
<span class='line'>999</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">--</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1000</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1001</span> </span><span class="WHIT">        </span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1002</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1003</span> 
<span class='line'>1004</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">found_initial</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1005</span> </span><span class="WHIT">        </span><span class="NAME">found_initial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1006</span> </span><span class="WHIT">        </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1007</span> </span><span class="WHIT">        </span><span class="KEYW">continue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1008</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1009</span> 
<span class='line'>1010</span> </span><span class="WHIT">      </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback.call</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1011</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1012</span> 
<span class='line'>1013</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">found_initial</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1014</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1015</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1016</span> 
<span class='line'>1017</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1018</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1019</span> 
<span class='line'>1020</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1021</span>    * Return the first index where the given value is found in the current array.
<span class='line'>1022</span>    *
<span class='line'>1023</span>    * &lt;p>Note that the method uses strict comparison for finding the value 
<span class='line'>1024</span>    * (&lt;code>===&lt;/code>).
<span class='line'>1025</span>    *
<span class='line'>1026</span>    * @example
<span class='line'>1027</span>    * &lt;code>var arr = ['a', 'b', 'c', 'd', 'b'];
<span class='line'>1028</span>    * arr.indexOf('b');&lt;/code>
<span class='line'>1029</span>    * // Returns 1.
<span class='line'>1030</span>    *
<span class='line'>1031</span>    * &lt;code>arr.indexOf('b', 2);&lt;/code>
<span class='line'>1032</span>    * // Returns 4.
<span class='line'>1033</span>    *
<span class='line'>1034</span>    * &lt;code>arr.indexOf('b', -2);&lt;/code>
<span class='line'>1035</span>    * // Returns 4.
<span class='line'>1036</span>    *
<span class='line'>1037</span>    * @param value The value you want to find in the current array.
<span class='line'>1038</span>    *
<span class='line'>1039</span>    * @param {Number} [offset=0] Zero-based index from where to start searching 
<span class='line'>1040</span>    * the array.
<span class='line'>1041</span>    * 
<span class='line'>1042</span>    * &lt;p>If the argument is not given, the entire array is searched.
<span class='line'>1043</span>    * 
<span class='line'>1044</span>    * &lt;p>If the number is negative, then the &lt;var>offset&lt;/var> is considered to 
<span class='line'>1045</span>    * be an offset from the end of the array. Thus, given a negative index like 
<span class='line'>1046</span>    * -3, it would mean that only the last three elements are checked.
<span class='line'>1047</span>    *
<span class='line'>1048</span>    * &lt;p>The method always starts searching from the calculated/given 
<span class='line'>1049</span>    * &lt;var>offset&lt;/var> increasing one by one up to the array length (forward 
<span class='line'>1050</span>    * search).
<span class='line'>1051</span>    *
<span class='line'>1052</span>    * @throws {TypeError} If &lt;var>value&lt;/var> is undefined.
<span class='line'>1053</span>    *
<span class='line'>1054</span>    * @returns {Number} The element index where the first occurrence of 
<span class='line'>1055</span>    * &lt;var>value&lt;/var> was found in the current array. If the value was not 
<span class='line'>1056</span>    * found, -1 is returned.
<span class='line'>1057</span>    *
<span class='line'>1058</span>    * @see $.js.Array.lastIndexOf
<span class='line'>1059</span>    */</span><span class="WHIT">
<span class='line'>1060</span> </span><span class="WHIT">  </span><span class="NAME">indexOf</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1061</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1062</span> 
<span class='line'>1063</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1064</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1065</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1066</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument is undefined.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1067</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1068</span> 
<span class='line'>1069</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1070</span> </span><span class="WHIT">      </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1071</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1072</span> </span><span class="WHIT">      </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">Math.ceil</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1073</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1074</span> </span><span class="WHIT">        </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1075</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1076</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1077</span> 
<span class='line'>1078</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1079</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">offset</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1080</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1081</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1082</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1083</span> 
<span class='line'>1084</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1085</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1086</span> 
<span class='line'>1087</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1088</span>    * Return the last index where the given value is found in the current array.
<span class='line'>1089</span>    *
<span class='line'>1090</span>    * &lt;p>Note that the method uses strict comparison for finding the value 
<span class='line'>1091</span>    * (&lt;code>===&lt;/code>).
<span class='line'>1092</span>    *
<span class='line'>1093</span>    * @example
<span class='line'>1094</span>    * &lt;code>var &lt;var>arr&lt;/var> = ['a', 'b', 'c', 'd', 'b'];
<span class='line'>1095</span>    * &lt;var>arr&lt;/var>.lastIndexOf('b');&lt;/code>
<span class='line'>1096</span>    * // Returns 4.
<span class='line'>1097</span>    *
<span class='line'>1098</span>    * &lt;code>&lt;var>arr&lt;/var>.lastIndexOf('b', 2);&lt;/code>
<span class='line'>1099</span>    * // Returns 1.
<span class='line'>1100</span>    *
<span class='line'>1101</span>    * &lt;code>&lt;var>arr&lt;/var>.lastIndexOf('b', -2);&lt;/code>
<span class='line'>1102</span>    * // Returns 1.
<span class='line'>1103</span>    *
<span class='line'>1104</span>    * @param value The value you want to find in the current array.
<span class='line'>1105</span>    *
<span class='line'>1106</span>    * @param {Number} [offset=this.length] Zero-based index from where to start 
<span class='line'>1107</span>    * searching backwards.
<span class='line'>1108</span>    * 
<span class='line'>1109</span>    * &lt;p>If the argument is not given, the entire array is searched.
<span class='line'>1110</span>    * 
<span class='line'>1111</span>    * &lt;p>If the number is negative, then the &lt;var>offset&lt;/var> is considered to 
<span class='line'>1112</span>    * be an offset from the end of the array. Thus, given a negative index like 
<span class='line'>1113</span>    * -3, it would mean that the last &lt;strong>two&lt;/strong> elements are 
<span class='line'>1114</span>    *  &lt;strong>not&lt;/strong> checked.
<span class='line'>1115</span>    *
<span class='line'>1116</span>    * &lt;p>The method always starts searching from the calculated/given 
<span class='line'>1117</span>    * &lt;var>offset&lt;/var> decreasing one by one, down to index 0 (backwards 
<span class='line'>1118</span>    * search).
<span class='line'>1119</span>    *
<span class='line'>1120</span>    * @throws {TypeError} If &lt;var>value&lt;/var> is undefined.
<span class='line'>1121</span>    *
<span class='line'>1122</span>    * @returns {Number} The element index where the last occurrence of 
<span class='line'>1123</span>    * &lt;var>value&lt;/var> was found in the current array. If the value was not 
<span class='line'>1124</span>    * found, -1 is returned.
<span class='line'>1125</span>    *
<span class='line'>1126</span>    * @see $.js.Array.indexOf
<span class='line'>1127</span>    */</span><span class="WHIT">
<span class='line'>1128</span> </span><span class="WHIT">  </span><span class="NAME">lastIndexOf</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1129</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1130</span> 
<span class='line'>1131</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1132</span> </span><span class="WHIT">      </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1133</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1134</span> </span><span class="WHIT">      </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">TypeError</span><span class="PUNC">(</span><span class="STRN">'The first argument is undefined.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1135</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1136</span> 
<span class='line'>1137</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1138</span> </span><span class="WHIT">      </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1139</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1140</span> </span><span class="WHIT">      </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">Math.ceil</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1141</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1142</span> </span><span class="WHIT">        </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1143</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1144</span> </span><span class="WHIT">        </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1145</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1146</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1147</span> 
<span class='line'>1148</span> </span><span class="WHIT">    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="PUNC">--</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1149</span> </span><span class="WHIT">      </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">offset</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1150</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1151</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1152</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1153</span> 
<span class='line'>1154</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1155</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1156</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1157</span> 
<span class='line'>1158</span> 
<span class='line'>1159</span> </span><span class="COMM">/**
<span class='line'>1160</span>  * Holds the methods used for manipulating strings. Some of them are already 
<span class='line'>1161</span>  * available in JavaScript 1.6, natively.
<span class='line'>1162</span>  *
<span class='line'>1163</span>  * &lt;p>By default, the global &lt;var>String.prototype&lt;/var> object is extended to 
<span class='line'>1164</span>  * contain all the methods in this namespace, if they do not exists already.  
<span class='line'>1165</span>  * Thus, native String methods are not overwritten.
<span class='line'>1166</span>  *
<span class='line'>1167</span>  * &lt;p>All of these methods use their &lt;var>this&lt;/var> object. As such, you need 
<span class='line'>1168</span>  * to pass the correct &lt;var>this&lt;/var> object.
<span class='line'>1169</span>  *
<span class='line'>1170</span>  * &lt;p>In the examples provided for each method we will assume that the strings 
<span class='line'>1171</span>  * defined already have the methods. Thus code like 
<span class='line'>1172</span>  * &lt;code>&lt;var>string&lt;/var>.trim()&lt;/code> can be written directly.
<span class='line'>1173</span>  *
<span class='line'>1174</span>  * @namespace Holds the methods used for manipulating strings. Some of them are 
<span class='line'>1175</span>  * already available in JavaScript 1.6, natively.
<span class='line'>1176</span>  */</span><span class="WHIT">
<span class='line'>1177</span> </span><span class="NAME">$.js.String</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1178</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1179</span>    * Trim whitespace from the start and the end of the string.
<span class='line'>1180</span>    *
<span class='line'>1181</span>    * @example
<span class='line'>1182</span>    * &lt;code>var str = " \n test \n  ";
<span class='line'>1183</span>    * var str2 = str.trim();&lt;/code>
<span class='line'>1184</span>    * // Now &lt;code>str2 = 'test'&lt;/code>.
<span class='line'>1185</span>    *
<span class='line'>1186</span>    * @returns {String} The string without any whitespace at the beginning, nor 
<span class='line'>1187</span>    * at the end.
<span class='line'>1188</span>    *
<span class='line'>1189</span>    * @see $.js.String.trimLeft
<span class='line'>1190</span>    * @see $.js.String.trimRight
<span class='line'>1191</span>    */</span><span class="WHIT">
<span class='line'>1192</span> </span><span class="WHIT">  </span><span class="NAME">trim</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1193</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="REGX">/^\s+|\s+$/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1194</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1195</span> 
<span class='line'>1196</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1197</span>    * Trim whitespace from the start of the string.
<span class='line'>1198</span>    *
<span class='line'>1199</span>    * @example
<span class='line'>1200</span>    * &lt;code>var str = " \n test \n  ";
<span class='line'>1201</span>    * var str2 = str.trimLeft();&lt;/code>
<span class='line'>1202</span>    * // Now &lt;code>str2 = "test \n  "&lt;/code>.
<span class='line'>1203</span>    *
<span class='line'>1204</span>    * @returns {String} The string without any whitespace at the beginning.
<span class='line'>1205</span>    *
<span class='line'>1206</span>    * @see $.js.String.trim
<span class='line'>1207</span>    * @see $.js.String.trimRight
<span class='line'>1208</span>    */</span><span class="WHIT">
<span class='line'>1209</span> </span><span class="WHIT">  </span><span class="NAME">trimLeft</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1210</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="REGX">/^\s+/</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1211</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1212</span> 
<span class='line'>1213</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1214</span>    * Trim whitespace from the end of the string.
<span class='line'>1215</span>    *
<span class='line'>1216</span>    * @example
<span class='line'>1217</span>    * &lt;code>var str = " \n test \n  ";
<span class='line'>1218</span>    * var str2 = str.trimRight();&lt;/code>
<span class='line'>1219</span>    * // Now &lt;code>str2 = " \n test"&lt;/code>.
<span class='line'>1220</span>    *
<span class='line'>1221</span>    * @returns {String} The string without any whitespace at the end.
<span class='line'>1222</span>    *
<span class='line'>1223</span>    * @see $.js.String.trim
<span class='line'>1224</span>    * @see $.js.String.trimLeft
<span class='line'>1225</span>    */</span><span class="WHIT">
<span class='line'>1226</span> </span><span class="WHIT">  </span><span class="NAME">trimRight</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1227</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="REGX">/\s+$/</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1228</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1229</span> 
<span class='line'>1230</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1231</span>    * Convert significant characters into entities. Any XML/HTML code has 
<span class='line'>1232</span>    * significant characters, like angle brackets and quotes. This method 
<span class='line'>1233</span>    * converts them to HTML entities, such that the resulting string can be used 
<span class='line'>1234</span>    * in Web pages without any problems.
<span class='line'>1235</span>    *
<span class='line'>1236</span>    * &lt;p>The characters being encoded are:
<span class='line'>1237</span>    *
<span class='line'>1238</span>    * &lt;ul>
<span class='line'>1239</span>    *   &lt;li>' &amp; ' to ' &amp;amp; '
<span class='line'>1240</span>    *   &lt;li>' &lt; ' to ' &amp;lt; '
<span class='line'>1241</span>    *   &lt;li>' &gt; ' to ' &amp;gt; '
<span class='line'>1242</span>    *   &lt;li>' " ' to ' &amp;#34; '
<span class='line'>1243</span>    *   &lt;li>" ' " to ' &amp;#39; '
<span class='line'>1244</span>    * &lt;/ul>
<span class='line'>1245</span>    *
<span class='line'>1246</span>    * @returns {String} The string with the special characters encoded.
<span class='line'>1247</span>    *
<span class='line'>1248</span>    * @see $.js.String.unescapeXML
<span class='line'>1249</span>    */</span><span class="WHIT">
<span class='line'>1250</span> </span><span class="WHIT">  </span><span class="NAME">escapeXML</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1251</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="REGX">/&/g</span><span class="PUNC">,</span><span class="WHIT">  </span><span class="STRN">'&amp;'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1252</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&lt;/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'&lt;'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1253</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/>/g</span><span class="PUNC">,</span><span class="WHIT">  </span><span class="STRN">'&gt;'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1254</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/"/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'&#34;'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1255</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/'/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'&#39;'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1256</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1257</span> 
<span class='line'>1258</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1259</span>    * Decode significant characters from entities. This is the reverse method of 
<span class='line'>1260</span>    * {@link $.js.String.escapeXML}.
<span class='line'>1261</span>    *
<span class='line'>1262</span>    * @returns {String} The string with the special characters decoded.
<span class='line'>1263</span>    *
<span class='line'>1264</span>    * @see $.js.String.escapeXML
<span class='line'>1265</span>    */</span><span class="WHIT">
<span class='line'>1266</span> </span><span class="WHIT">  </span><span class="NAME">unescapeXML</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1267</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="REGX">/&lt;/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'&lt;'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1268</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&gt;/g</span><span class="PUNC">,</span><span class="WHIT">  </span><span class="STRN">'>'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1269</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&#34;/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1270</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&#39;/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"'"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1271</span> </span><span class="WHIT">      </span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&amp;/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'&'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1272</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1273</span> 
<span class='line'>1274</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1275</span>    * Strip tags from a string.
<span class='line'>1276</span>    *
<span class='line'>1277</span>    * &lt;p>Optionally, you may provide the list of tags to be stripped from the 
<span class='line'>1278</span>    * string. Each argument is considered a tag name.
<span class='line'>1279</span>    *
<span class='line'>1280</span>    * &lt;p>If no argument is provided, then all the tags in the string are 
<span class='line'>1281</span>    * stripped.
<span class='line'>1282</span>    *
<span class='line'>1283</span>    * @params {String} [tag1] The name of the tag you want to strip.
<span class='line'>1284</span>    * @params {String} [tagN] The name of the tag you want to strip.
<span class='line'>1285</span>    *
<span class='line'>1286</span>    * @returns {String} The string with tags stripped.
<span class='line'>1287</span>    */</span><span class="WHIT">
<span class='line'>1288</span> </span><span class="WHIT">  </span><span class="NAME">stripTags</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1289</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tags</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'[a-zA-Z][a-zA-Z\d_]*'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1290</span> </span><span class="WHIT">    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">arguments.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1291</span> </span><span class="WHIT">      </span><span class="NAME">tags</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1292</span> </span><span class="WHIT">      </span><span class="NAME">$.js.Array.forEach.call</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1293</span> </span><span class="WHIT">        </span><span class="NAME">tags</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'|'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">$.js.String.escapeRegexp.call</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1294</span> </span><span class="WHIT">      </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1295</span> </span><span class="WHIT">      </span><span class="NAME">tags</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'('</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">tags.substr</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">')'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1296</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1297</span> 
<span class='line'>1298</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">regex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">RegExp</span><span class="PUNC">(</span><span class="STRN">'&lt;/?'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">tags</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'[^>]*>'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'g'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1299</span> 
<span class='line'>1300</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="NAME">regex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1301</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1302</span> 
<span class='line'>1303</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class='line'>1304</span>    * Escape special characters in regular expressions.
<span class='line'>1305</span>    *
<span class='line'>1306</span>    * @returns {String} The string with the special characters escaped.
<span class='line'>1307</span>    */</span><span class="WHIT">
<span class='line'>1308</span> </span><span class="WHIT">  </span><span class="NAME">escapeRegexp</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1309</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="REGX">/([$^\/()\\|?+*\[\]{}.-])/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"\\$1"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1310</span> </span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1311</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1312</span> 
<span class='line'>1313</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">extend_objects</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1314</span> </span><span class="WHIT">  </span><span class="NAME">Object.extend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.extend</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1315</span> </span><span class="WHIT">  </span><span class="NAME">$.extend</span><span class="PUNC">(</span><span class="NAME">Object</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$.js.Object</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1316</span> </span><span class="WHIT">  </span><span class="NAME">$.extend</span><span class="PUNC">(</span><span class="NAME">Array.prototype</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$.js.Array</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1317</span> </span><span class="WHIT">  </span><span class="NAME">$.extend</span><span class="PUNC">(</span><span class="NAME">String.prototype</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$.js.String</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1318</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1319</span> 
<span class='line'>1320</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1321</span> </span></pre></body></html>